# makefile

CC=gcc
CFLAGS=-std=c99 -g

all: server client echo.h naming-server

rmi.o: rmi.c rmi.h
	${CC} ${CFLAGS} -c rmi.c

server.o: server.c echo.h
	${CC} ${CFLAGS} -DRMI_SERVER -c server.c

client.o: client.c echo.h
	${CC} ${CFLAGS} -c client.c

server: server.o rmi.o
	${CC} ${CFLAGS} server.o rmi.o -o server -lpthread

client: client.o rmi.o
	${CC} ${CFLAGS} client.o rmi.o -o client -lpthread

naming-server:naming-server.c
	${CC} ${CFLAGS} naming-server.c -o naming-server -I/usr/include/libxml2 -lxml2

echo.h: rmi.xsl echo.xml
	xsltproc rmi.xsl echo.xml > echo.h

clean:
	rm -f *~ *.o echo.h naming-service.xml client server naming-server